Skip to content

fix(function_call): skip undefined tools in DeepSeek V3.2/V4 streams - #1727

Open
ZhouBencheng wants to merge 1 commit into
ModelTC:mainfrom
ZhouBencheng:fix/dsml-tool-names
Open

ZhouBencheng wants to merge 1 commit into
ModelTC:mainfrom
ZhouBencheng:fix/dsml-tool-names

Conversation

@ZhouBencheng

Copy link
Copy Markdown

DeepSeek V3.2/V4 can emit a streamed call to an undefined tool when its DSML invoke closes, as noted in #1697. For a request defining only get_weather, an invoke for undefined_tool becomes a tool call in the response.

Validate the name before allocating call state in both streaming branches. Skip undefined invokes and continue parsing the buffer so subsequent valid calls keep their arguments and indices.

The 36 new regression cases cover both parsers, chunk boundaries, and undefined calls before, between and after valid calls. Ran the same 85 tests, including the new cases, against the base commit (1a2a306d) and this change on Linux with Python 3.10:

Tests Before After
New undefined-tool regression cases 0/36 passed 36/36 passed
Existing parser and API helper tests 49/49 passed 49/49 passed
python -m pytest -q \
  unit_tests/server/test_deepseek_tool_parser_stream.py \
  unit_tests/server/test_deepseek_dsml_stream_args.py \
  unit_tests/server/test_function_call_common_prefix.py \
  unit_tests/server/test_glm47_tool_parser.py \
  unit_tests/server/test_qwen3_coder_stream_fc.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant